package com.adulcimer.models.entity.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 操作日志
 * @TableName s_operate_log
 */
@TableName(value ="s_operate_log")
@Data
public class OperateLog implements Serializable {
    /**
     * 日志ID
     */
    @TableId(value = "id")
    private String id;

    /**
     * 账号
     */
    @TableField(value = "account")
    private String account;

    /**
     * 姓名
     */
    @TableField(value = "name")
    private String name;

    /**
     * IP地址
     */
    @TableField(value = "ip_address")
    private String ipAddress;

    /**
     * 操作模块
     */
    @TableField(value = "module")
    private String module;

    /**
     * 操作内容
     */
    @TableField(value = "content")
    private String content;

    /**
     * 操作的具体内容
     */
    @TableField(value = "result_content")
    private String resultContent;

    /**
     * 请求参数
     */
    @TableField(value = "parameter")
    private String parameter;

    /**
     * 请求的uri
     */
    @TableField(value = "uri")
    private String uri;

    /**
     * 请求方式
     */
    @TableField(value = "method")
    private String method;

    /**
     * 运行时间
     */
    @TableField(value = "run_time")
    private String runTime;

    /**
     * 操作时间
     */
    @TableField(value = "created_at")
    private LocalDateTime createdAt;

    /**
     * 类型细分
     */
    @TableField(value = "type")
    private String type;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        OperateLog other = (OperateLog) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getAccount() == null ? other.getAccount() == null : this.getAccount().equals(other.getAccount()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getIpAddress() == null ? other.getIpAddress() == null : this.getIpAddress().equals(other.getIpAddress()))
            && (this.getModule() == null ? other.getModule() == null : this.getModule().equals(other.getModule()))
            && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
            && (this.getResultContent() == null ? other.getResultContent() == null : this.getResultContent().equals(other.getResultContent()))
            && (this.getParameter() == null ? other.getParameter() == null : this.getParameter().equals(other.getParameter()))
            && (this.getUri() == null ? other.getUri() == null : this.getUri().equals(other.getUri()))
            && (this.getMethod() == null ? other.getMethod() == null : this.getMethod().equals(other.getMethod()))
            && (this.getRunTime() == null ? other.getRunTime() == null : this.getRunTime().equals(other.getRunTime()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getAccount() == null) ? 0 : getAccount().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getIpAddress() == null) ? 0 : getIpAddress().hashCode());
        result = prime * result + ((getModule() == null) ? 0 : getModule().hashCode());
        result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
        result = prime * result + ((getResultContent() == null) ? 0 : getResultContent().hashCode());
        result = prime * result + ((getParameter() == null) ? 0 : getParameter().hashCode());
        result = prime * result + ((getUri() == null) ? 0 : getUri().hashCode());
        result = prime * result + ((getMethod() == null) ? 0 : getMethod().hashCode());
        result = prime * result + ((getRunTime() == null) ? 0 : getRunTime().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", account=").append(account);
        sb.append(", name=").append(name);
        sb.append(", ipAddress=").append(ipAddress);
        sb.append(", module=").append(module);
        sb.append(", content=").append(content);
        sb.append(", resultContent=").append(resultContent);
        sb.append(", parameter=").append(parameter);
        sb.append(", uri=").append(uri);
        sb.append(", method=").append(method);
        sb.append(", runTime=").append(runTime);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", type=").append(type);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}